
// 批量绑定背景图
//批量绑定鼠标事件
// 批量绑定颜色
let colorArr = ["linear-gradient(to bottom, rgb(247, 158, 94),rgb(245, 88, 77))","linear-gradient(to bottom, rgb(170, 197, 188),rgb(47, 209, 89))","linear-gradient(to bottom, rgb(190, 224, 248),rgb(6, 158, 253))","linear-gradient(to bottom, rgb(93, 141, 238),rgb(169, 75, 236))","linear-gradient(to bottom, rgb(241, 96, 138),rgb(169, 79, 218))","linear-gradient(to bottom, rgb(59, 206, 166),rgb(14, 117, 236))"];
$(".lift-list a").each(function(index,item) {
    $(item).css({
        "background-image":"url(../imgs/store/lift-icon-"+index+".png)",
        "background-size":"contain",
    });
    // $(item).on("mouseover",function () {
    //     $(this).addClass("lift-on");
    // });
    // $(item).on("mouseout",function () {
    //     $(this).removeClass("lift-on");
    // });
});


$(".lift-list li").mouseover(function(){
   
        let index = $(this).index();
        $(this).children("a").css("background-image",colorArr[index])
        console.log($(this).children("a").css("background-image"));
})

$(".lift-list li").mouseout(function(){
        let index = $(this).index();
        $(this).children("a").css({
        "background-image":"url(imgs/store/lift-icon-"+index+".png)",
        "background-size":"contain",});
        });
   

//电梯功能实现

$(".lift-list li").nextUntil("ul").click(function(){
    let index = $(this).index()-1;
    let floor = $(".floor").eq(index);
    let top = floor.offset().top;
    $("html,body").stop(true).animate({
        scrollTop:top-60
    },1000);
});